package MailBox;

import java.util.Random;

public class TukangPos implements Runnable{
	private KotakSurat kotakSurat;
	
	public TukangPos(KotakSurat kotakSurat){
		this.kotakSurat = kotakSurat;
	}
	
	public void antar()throws InterruptedException{
		kotakSurat.masukkan();
	}
	
	public void run(){
		try{
			for (int i = 0; i<5; i++){
				antar();
				System.out.println("Jumlah Surat: " +kotakSurat.jumlah());
				Thread.sleep(new Random().nextInt(2000));
			}
		}catch (Exception err){
			err.printStackTrace();
		}
	}	
}
